#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([gUrl], [0.1], [http://code.google.com/p/gurl/issues/])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC
AC_PROG_LEX
AC_PROG_RANLIB

# Checks for libraries.
PKG_CHECK_MODULES([GTK], [gtk+-3.0])
PKG_CHECK_MODULES([cUrl], [libcurl])
PKG_CHECK_MODULES([GHex], [gtkhex-3],
		[
			AC_DEFINE(HAVE_GHEX, [1], [Use GHex])
			enable_ghex="yes"
		],
		[
			AC_MSG_WARN("GHex package was not found in your system. Some features was disabled")
			enable_ghex="no"
		])
PKG_CHECK_MODULES([GTKHTML], [gtkhtml-editor-4.0],
		[
			AC_DEFINE(HAVE_GTKHTML, [1], [Use GtkHtml])
			enable_gtkhtml="yes"
		],
		[
			AC_MSG_WARN("GtkHtml package was not found in your system. Some features was disabled")
			enable_gtkhtml="no"
		])
PKG_CHECK_MODULES([JSON_GLib], [json-glib-1.0],
		[
			AC_DEFINE(HAVE_JSON_GLIB, [1], [Use JSON-GLib])
			enable_json_glib="yes"
		],
		[
			AC_MSG_WARN("Json-GLIB package was not found in your system. Some features was disabled")
			enable_json_glib="no"
		])

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_PROG_CC_C99
AM_PROG_CC_C_O

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE

# ***********
# Translation
# ***********

AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.50.1])

GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package.])

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)

# ***********

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/highlighter/Makefile
                 po/Makefile.in
                 pixmaps/Makefile])
AC_OUTPUT

echo "
Configuration:
	Source code location:         $srcdir
	Compiler:                     $CC
	GHex:                         $enable_ghex
	GtkHtml:                      $enable_gtkhtml
	JSON-GLib:                    $enable_json_glib
"

echo $EXTRA_DIST
